<?php

include_once "lib/config.php";
include_once "lib/pdomanager.php";

include_once "lib/functions.php";

DB::$dbname=DBNAME;
DB::$hostname=HOST;
DB::$dbusername=USERNAME;
DB::$dbpassword=PASSWORD;
DB::$dbtype=TYPE;
DB::$portnumber=PORTNUMBER;

DB::connect();

$select_query="select users.*,user_type from users,user_types where users.type_id=user_types.id ";	
$res_query=DB::fetch_array(DB::query($select_query));
if(count($res_query)>0)
{
	?>
	<table>
		<tr>
			<td>Usernmame</td>
			<td>code</td>
			<td>Password</td>
            <td>User Type</td>
		</tr>
		<?php
		for($i=0;$i<count($res_query);$i++)
		{
			?>
			<tr>
				<td><?php echo trim($res_query[$i]['first_name']." ".$res_query[$i]['last_name']); ?></td>
				<td><?php echo trim($res_query[$i]['ecode']); ?></td>
				<td><?php echo base64_decode($res_query[$i]['password_encrypted']); ?></td>
                <td><?php echo $res_query[$i]['user_type']; ?></td>
			</tr>
			<?php
		}
		?>
	</table>
	<?php
}
?>